xen/arm: Construct the P2M pages pool for guests
authorHenry Wang <Henry.Wang@arm.com>
Tue, 11 Oct 2022 12:55:21 +0000 (14:55 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 11 Oct 2022 12:55:21 +0000 (14:55 +0200)
commit914fc8e8b4cc003e90d51bee0aef54687358530a
tree5ece458e59729ac81c3c2bd5a676aa47367b4f13
parent755a9b52844de3e1e47aa1fc9991a4240ccfbf35
xen/arm: Construct the P2M pages pool for guests

This commit constructs the p2m pages pool for guests from the
data structure and helper perspective.

This is implemented by:

- Adding a `struct paging_domain` which contains a freelist, a
counter variable and a spinlock to `struct arch_domain` to
indicate the free p2m pages and the number of p2m total pages in
the p2m pages pool.

- Adding a helper `p2m_get_allocation` to get the p2m pool size.

- Adding a helper `p2m_set_allocation` to set the p2m pages pool
size. This helper should be called before allocating memory for
a guest.

- Adding a helper `p2m_teardown_allocation` to free the p2m pages
pool. This helper should be called during the xl domain destory.

This is part of CVE-2022-33747 / XSA-409.

Signed-off-by: Henry Wang <Henry.Wang@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
master commit: 55914f7fc91a468649b8a3ec3f53ae1c4aca6670
master date: 2022-10-11 14:28:39 +0200
xen/arch/arm/p2m.c
xen/include/asm-arm/domain.h
xen/include/asm-arm/p2m.h